using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Mark.Models;

/// <summary>
/// 消息文件关联实体
/// </summary>
public class MessageFile : BaseEntity
{
    /// <summary>
    /// 文件在消息中的角色：attachment, reference, inline
    /// </summary>
    [MaxLength(20)]
    public string Role { get; set; } = "attachment";
    
    /// <summary>
    /// 文件描述或注释
    /// </summary>
    [MaxLength(500)]
    public string? Description { get; set; }
    
    /// <summary>
    /// 排序顺序
    /// </summary>
    public int SortOrder { get; set; } = 0;
    
    // 外键
    [Required]
    public string MessageId { get; set; } = string.Empty;
    
    [Required]
    public string FileInfoId { get; set; } = string.Empty;
    
    // 导航属性
    [ForeignKey("MessageId")]
    public virtual Message Message { get; set; } = null!;
    
    [ForeignKey("FileInfoId")]
    public virtual FileInfo FileInfo { get; set; } = null!;
} 